/**
 * Created by XianTao on 2016/4/26
 * <p/>
 * Copyright (c) 2015-2015
 * Apache License
 * Version 2.0, January 2004
 * http://www.apache.org/licenses/
 */
package org.lego.wechat.portal.service;

import lombok.extern.slf4j.Slf4j;
import org.lego.wechat.base.entity.WxCorp;
import org.lego.wechat.base.msg.OutMsgXmlBuilder;
import org.lego.wechat.base.msg.out.OutMsg;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Service
@Slf4j
public class WechatSender {
    /**
     * 被动应答消息字符串
     *
     * @param wxCorp  微信号
     * @param request HttpServletRequest
     * @param outMsg  应答实体类
     * @return 应答消息字符串
     */
    public String getOutMsg(WxCorp wxCorp, HttpServletRequest request, OutMsg outMsg) {
        String replyMsg = OutMsgXmlBuilder.build(outMsg);
        log.info("应答消息: \n{}", replyMsg);
        return replyMsg;
    }
}
